<html><head><title>WindowOutput</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">WindowOutput()</font></b></p>
<p><b>Syntax</b></p><blockquote>
OutputID = <font color="#3A3966"><b>WindowOutput</b></font>(#Window)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Returns the OutputID of the given window to perform 2D rendering operation on it. It will use 
the PureBasic <a href="../2ddrawing/index.html">2DDrawing library</a> and can only be used within a <a href="../2ddrawing/startdrawing.html">StartDrawing()</a> / 
<a href="../2ddrawing/stopdrawing.html">StopDrawing()</a> block. The memory allocated in WindowOutput() is released on StopDrawing(). 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Window</i></td>
<td width="90%"> 
The window to use. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

The OutputID of the given window to perform 2D rendering operation on it using <a href="../2ddrawing/startdrawing.html">StartDrawing()</a>. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 220, 100, &quot;Example...&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)

    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
      
      <b><font color="#3A3966">If</font></b> Event = PB_Event_Repaint <font color="#3A3966">; Redraw on the window every time the window is repainted</font>
<font color="#3A3966">        StartDrawing</font>(<font color="#3A3966">WindowOutput</font>(0))
<font color="#3A3966">          Box</font>(10, 10, 50, 50,<font color="#3A3966"> RGB</font>(255, 0, 0)) 
<font color="#3A3966">        StopDrawing</font>()
      <b><font color="#3A3966">EndIf</font></b>
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>Remarks</b></p><blockquote>

Content drawn on a window will be erased whenever the window or a part of it is covered 
by another window, moved outside of the screen or when the window is hidden or minimized. So to keep 
the drawn content visible, it must be redrawn after every <font color="#924B72">#PB_Event_Repaint</font> event. 
A more convenient alternative is to draw the content to an image via <a href="../image/imageoutput.html">ImageOutput()</a> 
and display it as <a href="../gadget/imagegadget.html">ImageGadget()</a> in the application window and if 
necessary, update it with <a href="../gadget/setgadgetstate.html">SetGadgetState()</a>. This way all needed 
refreshing will be handled by the ImageGadget. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 220, 100, &quot;Example...&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
    
<font color="#3A3966">    ButtonGadget  </font>(1, 10, 60, 200, 30, &quot;Draw on window&quot;)
   
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
          
      <b><font color="#3A3966">Select</font></b> Event
     
        <b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event_Gadget</font>
          <b><font color="#3A3966">Select</font></b> <font color="#3A3966">EventGadget</font>()
            <b><font color="#3A3966">Case</font></b> 1
              <font color="#3A3966">; Draw a red box on the window</font>
              <b><font color="#3A3966">If</font></b> <font color="#3A3966">StartDrawing</font>(<font color="#3A3966">WindowOutput</font>(0))
<font color="#3A3966">                Box</font>(10,10, 200, 30,<font color="#3A3966"> RGB</font>(255, 0, 0))
<font color="#3A3966">                StopDrawing</font>()
              <b><font color="#3A3966">EndIf</font></b>
                                                          
          <b><font color="#3A3966">EndSelect</font></b>
            
      <b><font color="#3A3966">EndSelect</font></b>
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="../2ddrawing/startdrawing.html">StartDrawing()</a>, <a href="windowvectoroutput.html">WindowVectorOutput()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=windowmousey.html>WindowMouseY()</a> - <a href="index.html">Window Index</a> - <a href="windowvectoroutput.html">WindowVectorOutput()</a> -><br><br>

</body></html>